package com.qf.blog.service.serviceimpl;

import com.qf.blog.core.dao.IbaseDao;
import com.qf.blog.core.servise.impl.BaseServiceImpl;
import com.qf.blog.dao.SystemUserDAO;
import com.qf.blog.dao.daoimpl.SystemUserDAOImpl;
import com.qf.blog.entity.SystemUserEntity;
import com.qf.blog.mybatis.SqlSessionThreadLocal;
import com.qf.blog.service.SystemUserService;
import org.apache.ibatis.session.SqlSession;

/**
 * @author zyt
 * @version 1.0
 */
public class SystemUserServiceImpl extends BaseServiceImpl<SystemUserEntity> implements SystemUserService{
    // 创建dao对象
//   private SystemUserDAO systemUserDAO = new SystemUserDAOImpl();
    @Override
    protected IbaseDao<SystemUserEntity> getBaseDao(){
        // 从SqlSessionThreadLocal中获取SqlSession对象，创建Mapper
        // 现在sqlsession都在SqlSessionThreadLocal中 直接通过get方法获取
        SqlSession sqlSession = SqlSessionThreadLocal.get();
        //返回一个mapper
        return sqlSession.getMapper(SystemUserDAO.class);
    }
}
